package com.BEASTMODE.libs;

import java.util.Date;
import android.app.Activity;

import android.view.MotionEvent;

public abstract class GameThread extends Thread
{
	protected boolean _running;
	protected Activity _activity;
	
	protected GameThread(Activity activity)
	{
		_activity = activity;
	}
	
	public void setRunning(boolean Running)
	{
		_running = Running;
	}
	
	@Override
	public void run()
	{
		Date _thisTime, _lastTime = new Date();
		while (_running)
		{
			_thisTime = new Date();
			DoWork((_thisTime.getTime() - _lastTime.getTime()) * 0.0001f);
			_lastTime = _thisTime;
		}
		Stopping();
	}
	
	protected abstract void Stopping();
	protected abstract void DoWork(float dT);
	public abstract void TouchEventReceived(MotionEvent evt);
}
